home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows (5th Edition) / Programming Windows, 5th ed. - Companion CD (097-0002183)(1999).iso / Chap11 / Colors3 / Colors3.c next >
Encoding:
C/C++ Source or Header  |  1998-10-09  |  833 b   |  27 lines

  1. /*----------------------------------------------
  2.    COLORS3.C -- Version using Common Dialog Box
  3.                 (c) Charles Petzold, 1998
  4.   ----------------------------------------------*/
  5.  
  6. #include <windows.h>
  7. #include <commdlg.h>
  8.  
  9. int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
  10.                     PSTR szCmdLine, int iCmdShow)
  11. {
  12.      static CHOOSECOLOR cc ;
  13.      static COLORREF    crCustColors[16] ;
  14.  
  15.      cc.lStructSize    = sizeof (CHOOSECOLOR) ;
  16.      cc.hwndOwner      = NULL ;
  17.      cc.hInstance      = NULL ;
  18.      cc.rgbResult      = RGB (0x80, 0x80, 0x80) ;
  19.      cc.lpCustColors   = crCustColors ;
  20.      cc.Flags          = CC_RGBINIT | CC_FULLOPEN ;
  21.      cc.lCustData      = 0 ;
  22.      cc.lpfnHook       = NULL ;
  23.      cc.lpTemplateName = NULL ;
  24.  
  25.      return ChooseColor (&cc) ;
  26. }
  27.